package net.lab1024.sa.admin.module.business.erp.bas.controller;

import net.lab1024.sa.admin.module.business.erp.bas.domain.form.SiteordAddForm;
import net.lab1024.sa.admin.module.business.erp.bas.domain.form.SiteordQueryForm;
import net.lab1024.sa.admin.module.business.erp.bas.domain.form.SiteordUpdateForm;
import net.lab1024.sa.admin.module.business.erp.bas.domain.vo.SiteordVO;
import net.lab1024.sa.admin.module.business.erp.bas.service.SiteordService;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import cn.dev33.satoken.annotation.SaCheckPermission;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 发货通知单 Controller
 *
 * @Author sp
 * @Date 2025-11-12 17:06:24
 * @Copyright sp
 */

@RestController
@Tag(name = "发货通知单")
public class SiteordController {

    @Resource
    private SiteordService siteordService;

    @Operation(summary = "分页查询 @author sp")
    @PostMapping("/siteord/queryPage")
    @SaCheckPermission("siteord:query")
    public ResponseDTO<PageResult<SiteordVO>> queryPage(@RequestBody @Valid SiteordQueryForm queryForm) {
        return ResponseDTO.ok(siteordService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author sp")
    @PostMapping("/siteord/add")
    @SaCheckPermission("siteord:add")
    public ResponseDTO<String> add(@RequestBody @Valid SiteordAddForm addForm) {
        return siteordService.add(addForm);
    }

    @Operation(summary = "更新 @author sp")
    @PostMapping("/siteord/update")
    @SaCheckPermission("siteord:update")
    public ResponseDTO<String> update(@RequestBody @Valid SiteordUpdateForm updateForm) {
        return siteordService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author sp")
    @PostMapping("/siteord/batchDelete")
    @SaCheckPermission("siteord:delete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return siteordService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author sp")
    @GetMapping("/siteord/delete/{id}")
    @SaCheckPermission("siteord:delete")
    public ResponseDTO<String> batchDelete(@PathVariable Long id) {
        return siteordService.delete(id);
    }
}
